scaffe.js
Simple scaffolding utility, inspired by Sao.js
Installation
$ npm install scaffe --save
Programmatic Usage
const scaffe = require("scaffe")
...
scaffe.generate(template_dir, outDir, { name: appName }, (err) => {
if(err){
console.error(err)
} else {
console.log("Successfully generated")
}
})
The only available function in Scaffe is generate
which takes arguments as
following in order.
templateDir
: It's the path to the template directory.
outDir
: The output directory
values
: An Object mapped from variables to it's values
cb
: A callback function that have err
as the only argument
Template directory can have two types files
starts with _
: this file will be evaluated as an ejs file
doesn't starts with _
: this type of files will be copied as it is to the output directory.
So we can uses variables in our template files in ejs format.
A use case,
{
"name": "<%= appName %>"
}
values
i.e. 3rd argument; will contain all variable values that
needs to be passed on to pe processed by ejs.